class CreateOrders < ActiveRecord::Migration
  def self.up
    create_table :orders do |t|
      t.string :order_no
      t.integer :buyer_id
      t.integer :dept_id
      t.date :ordered_on,
        :deliveried_on      
      t.integer :saler_id      
      t.decimal :sale_price,
        :order_price,
        :precision => 8, :scale => 2
      t.integer :creator_id
      t.text :remark
      t.string :status, :default => 'being_edited'
      t.timestamp :edited_at,
        :effected_at,
        :blanked_out_at
      t.timestamps
    end
  end

  def self.down
    drop_table :orders
  end
end
